#define DEBUG
#include <cstdio>

using namespace std;

const int maxn=100, maxm=2000, mods=998244353;

int main() {
#ifdef DEBUG
  freopen("src.in", "r", stdin);
  freopen("src.out", "w", stdout);
#endif

  static long long a[maxn+1][maxm+1], sum[maxn+1];
  long long ans=1;
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i=1; i<=n; i++) {
    for (int j=1; j<=m; j++) {
      scanf("%lld", &a[i][j]);
      sum[i] = (sum[i]+a[i][j])%mods;
    }
    ans = ans*(sum[i]+1)%mods;
  }
  ans = (ans+mods-1)%mods;

  static long long f[2][maxm+1][2*maxn+1];
  for (int i=1; i<=m; i++) {
    f[0][i][n] = 1;
  }
  for (int x=1; x<=n; x++) {
    for (int i=1; i<=m; i++) {
      int u=(x-1)%2, v=x%2;
      f[v][i][0] = (f[u][i][0]+f[u][i][1]*((sum[x]-a[x][i]+mods)%mods)%mods)%mods;
      f[v][i][2*n] = (f[u][i][2*n]+f[u][i][2*n-1]*a[x][i]%mods)%mods;
      for (int j=1; j<2*n; j++) {
	f[v][i][j] = (f[u][i][j]+(f[u][i][j-1]*a[x][i]%mods+f[u][i][j+1]*(sum[x]+mods-a[x][i])%mods)%mods)%mods;
      }
    }
  }

  int x=n%2;
  for (int i=1; i<=m; i++) {
    for (int j=n+1; j<=2*n; j++) {
      ans = (ans+mods-f[x][i][j])%mods;
    }
  }

  printf("%lld", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
